<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:url value="/" var="baseUrl" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="img/favicon.png">
<link rel="stylesheet" href="${baseUrl}layui/css/layui.css"  media="all">
<title>山东电信宽带异常分析助手</title>
<%@include file="../include/css.jsp"%>
 <script language="javascript" type="text/javascript">
function cow(){
var op= document.getElementById("select").value;
window.alert(op);
}
</script>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>  
    <script type="text/javascript" src="${baseUrl}layer-v3.0.3/layer/layer.js"></script> 
  <script type="text/javascript">  
        ;!function(){  
            layer.config({//加载扩展模块  
                extend: 'extend/layer.ext.js'  
            });  
            layer.ready(function(){   
            });  
        }();  
          
        function ityzl_SHOW_LOAD_LAYER(){  
            return layer.msg('努力计算中，请稍候...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '430px', time:100000}) ;  
        }  
        function ityzl_CLOSE_LOAD_LAYER(index){  
            layer.close(index);  
        }  
        function ityzl_SHOW_TIP_LAYER(){  
            layer.msg('恭喜您，加载完成！',{time: 1000,offset: '10px'});  
        }  
    </script>  
 <script type="text/javascript">  
$(function(){ 
	$("#pageJumpButton").hide();
    $("#btnRequest").bind("click", function () {  
        var i ;
        var date=$('#years').val()+$('#date').val();
        var city=$('#citys').val();
        $.ajax({  
            type: "post",  
            dataType: "json", 
            data:{"date":date,"city":city}, 
            url: "${baseUrl}front/JsonSumSigBasAAA",  
            beforeSend: function () {  
                i = ityzl_SHOW_LOAD_LAYER();  
            },  
            success: function (data) {  
                ityzl_CLOSE_LOAD_LAYER(i);
                
                
                jsonData = data;
                pn = 1;
                totalCount = jsonData.total;
                pageSize = 10;
                pageTotal = Math.ceil(totalCount / pageSize);
                $("#total-page").text(pageTotal);
                
                $("#next").click(function() {
                  if (pn == pageTotal) {
                    pn = pageTotal;
                  } else {
                    pn++;
                    gotoPage();
                  }
                });
                $("#prev").click(function() {
                  if (pn == 1) {
                    pn = 1;
                  } else {
                    pn--;
                    gotoPage();
                  }
                });
                $("#firstPage").click(function() {
                  pn = 1;
                  gotoPage();
                });
                $("#lastPage").click(function() {
                  pn = pageTotal;
                  gotoPage();
                });
                $("#firstPage").trigger("click");
                
                
                ityzl_SHOW_TIP_LAYER(); 
            },  
            error: function (e, jqxhr, settings, exception) {  
                ityzl_CLOSE_LOAD_LAYER(i);  
            }  
        });  
    });  
});  

function gotoPage() {
	  $("#current-page").text(pn);
	  
      var startPage = pageSize * (pn - 1);
      var endPage = startPage + pageSize - 1;
      var $tb = $("#table-json");
      $tb.empty();
      $tb.append("<tr><th>城市</th><th>帐号</th><th>SIG数据</th><th>BAS数据</th><th>AAA数据</th><th>查看</th></tr>");
      for (var i = 0; i < pageSize; i++) {
        $tb.append('<tr class="tr-tag"></tr>');
      }
      var subjects = jsonData.subjects;
      
      if (pageTotal == 1) {
    	      $("#pageJumpButton").hide();
          for (var j = 0; j < totalCount; j++) {
        	  var a=subjects[j].sumSig;
        	  var b=subjects[j].sumBas;
        	  var c=subjects[j].sumAAA;
        	  
        	  if(a==1)  a="<font color='red'>异常</font>";  else a='';
        	  if(b==1)  b="<font color='red'>异常</font>";  else b='';
        	  if(c==1)  c="<font color='red'>异常</font>";  else c='';
        	  
              $(".tr-tag").eq(j)
              .append("<td>" + subjects[j].city + "</td>")
              .append("<td>" + subjects[j].account + "</td>")
              .append("<td>" + a + "</td>")
              .append("<td>" + b + "</td>")
              .append("<td>" + c + "</td>")
              .append("<td>" + "<a href='ListAccount?account="+subjects[j].account+"'>全景</a>" + "</td>");
             
          }
      } else {
    	      $("#pageJumpButton").show();
          for (var j = startPage, k = 0; j < endPage, k < pageSize; j++, k++) {
            if(j == totalCount) {
              break;
            }
            
            	var a=subjects[j].sumSig;
          	  var b=subjects[j].sumBas;
          	  var c=subjects[j].sumAAA;
          
          	  if(a==1)  a="<font color='red'>异常</font>";  else a='';
          	  if(b==1)  b="<font color='red'>异常</font>";  else b='';
          	  if(c==1)  c="<font color='red'>异常</font>";  else c='';
          	 
            $(".tr-tag").eq(k)    
              .append("<td>" + subjects[j].city + "</td>")
              .append("<td>" + subjects[j].account + "</td>")
              .append("<td>" + a + "</td>")
              .append("<td>" + b + "</td>")
              .append("<td>" + c + "</td>")
              .append("<td>" + "<a href='ListAccount?account="+subjects[j].account+"'>全景</a>" + "</td>");
          
      }
      
}}

</script> 

  </head>

  <body>
 
	
  <!-- container section start -->
  <section id="container" class="">
     <%@include file="../include/header.jsp"%>
		<%@include file="../include/sidebar.jsp"%>
               
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">            
              <!--overview start-->
			     
           
              
            <!--/.row--><!-- Today status end --><!-- statics end -->
              <!--主显示区域--开始-->
              <form action="${baseUrl}front/ListSumSigBasAAA" method="post">
		<div align="center" >
		<c:if test="${curUser.id==0}">	
        <label >请选择地市 ：</label>
        <select class="easyui-combobox" id="citys" name="select" panelHeight="auto" style="    width:60px; padding-top:5px; margin-top:10px;">
<option value="全省" selected="selected">全省</option> 
<option value='济南' >济南</option>
  <option value='聊城' >聊城</option>
  <option value='德州' >德州</option>
  <option value='东营' >东营</option>
  <option value='淄博' >淄博</option>
  <option value='潍坊' >潍坊</option>
  <option value='烟台' >烟台</option>
  <option value='威海' >威海</option>
  <option value='青岛' >青岛</option>
  <option value='日照' >日照</option>
  <option value='临沂' >临沂</option>
  <option value='枣庄' >枣庄</option>
  <option value='济宁' >济宁</option>
  <option value='泰安' >泰安</option>
  <option value='莱芜' >莱芜</option>
  <option value='滨州' >滨州</option>
  <option value='菏泽' >菏泽</option>
  </select>
		
    </c:if>
		
		<label >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请选择分析的月份 ：</label>
    
   <select class="easyui-combobox" id="years" name="select" panelHeight="auto" style="    width:60px; padding-top:5px; margin-top:10px;">
<option value="2016">2016</option> 
<option value="2017" selected="selected">2017</option> 
<option value="2018">2018</option> 
  </select>年
  <select class="easyui-combobox" id="date" name="date"  panelHeight="auto" style="    width:40px; padding-top:5px; margin-top:10px;">
<option value="01">01</option> 
<option value="02">02</option> 
<option value="03">03</option> 
<option value="04">04</option> 
<option value="05">05</option> 
<option value="06">06</option> 
<option value="07">07</option>
<option value="08" selected="selected">08</option> 
<option value="09">09</option>
<option value="10">10</option> 
<option value="11">11</option> 
<option value="12">12</option>   
  </select>月 
  <input type="button"  class="layui-btn layui-btn-normal" id="btnRequest" value="开始分析" name="find">
</div>

    <div id="mainContent">
	    <header class="panel-heading">
		    <div style="display: inline-block; width: 90%; text-align: center">Sig、Bas、AAA数据异常比对结果</div>
		    
	    </header>
		<table class="table table-striped table-advance table-hover">
			<tbody id="table-json">
			<tr>
			<th>地市</th>
			<th>账号</th>
				<th>SIG共享异常</th>
				<th>BAS拨号异常</th>
				<th>AAA流量异常</th>				
				<th>查看明细</th>
			</tr>
			</tbody>
		</table>
		<div align="center" id="pageJumpButton">
          <button type="button" id="firstPage">首页</button>
          <button type="button" id="prev">上一页</button>
	      第<span id="current-page">1</span>页&nbsp;
	      共<span id="total-page">0</span>页
	      <button type="button" id="next">下一页</button>
	      <button type="button" id="lastPage">尾页</button>
	    </div>
	</div>
	</form>


			  <!--主显示区域--结束-->
          </section>
      </section>
      <!--main content end-->
  </section>
  <!-- container section start -->

   <%@include file="../include/scripts.jsp"%>
<script>
$("#sidebarMyChart").addClass('active');
$("#sidebarListSameMac").removeClass('active');
$("#sidebarListAvgFlow").removeClass('active');
$("#sidebarScatter").removeClass('active');
$("#sidebarListSigData").removeClass('active');
$("#sidebarListTop10").removeClass('active');
$("#sidebarListAccount").removeClass('active');
$("#sidebarBWListAdmin").removeClass('active');
$("#sidebarListDoc").removeClass('active');
$("#sidebarListUser").removeClass('active');
</script>


  </body>
</html>
